package com.example.touch.domain;

import java.util.ArrayList;
import java.util.Collection;

/**
*
* @author pla
*/
public abstract class AbstractActionSequence 
extends ArrayList<IActivityAction> implements ICompositeAction
{
	private static final long serialVersionUID = 1877900672950209675L;

	protected abstract void doExecuteAll(Collection<IActivityAction> activityActions);
	
	public AbstractActionSequence(Collection<IActivityAction> activityActions)
	{
		super(activityActions);
	}
	
	@Override
	public Collection<IActivityAction> getActivityActions() 
	{
		return this;
	}

	@Override
	public void setActivityActions(Collection<IActivityAction> activityActions) 
	{
		clear();
		addAll(activityActions);
	}

	@Override
	public void addRange(Collection<IActivityAction> activityActions) 
	{
		addAll(activityActions);
	}

	@Override
	public void addAction(IActivityAction action)
	{
		add(action);
	}
	
	@Override
	public void invoke() 
	{
		this.doExecuteAll(this);
	}
}
